package entity.lemming;

import java.awt.Rectangle;

import entity.Entity;
import entity.terrain.Terrain;
import level.*;

/**
 * The Basher Lemming, a Lemming that digs horizontally through the terrain.
 * 
 * @author Neil Cowzer
 */
public class Basher extends Lemming {
	
	

	/**
	 * Create an instance of the Basher Lemming.
	 * 
	 * @param x the starting x-coordinate.
	 * @param y the starting y-coordinate.
	 * @param level the current level.
	 */
	/*@ requires 0 <= x && 0 <= y;
		assignable speed_X && speed_Y && energy;
		ensures speed_X != 0 && speed_Y == 0 && energy == 100;
	 */
	public Basher(int x, int y){
			super("tobefilled.gif",8, x, y);
			speed_X = 10;
			speed_Y = 0;
			energy = 100;
		}


	/**
	 * Checks for a collision with another Entity
	 * 
	 * @param other another Entity eg Terrain, Lemming.
	 * @return true if a collision has occured.
	 */
	public /*@ pure @*/ boolean collision(Entity other) {
		Rectangle me = getBounds();
		if (other instanceof Blocker || other instanceof Terrain){
			if (me.intersects(other.getBounds())){
				//return true;
			}
		}
		
		return false;
	}

	/** Perform the logic of moving a Lemming. */
	//@ ensures x = \old(x) + speed_X && energy == \old(energy) -1;
	public void move(Terrain terrain) {
		// TODO Auto-generated method stub
	}
	
	/** Reverse a Lemmings direction */
	/*@ ensures speed_X == 0 - \old(speed_X) &&
	 			speed_Y == 0 - \old(speed_Y);
	@*/
	public void turnAround(){
		speed_X = -(speed_X);
	}

}
